home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’96 / FinderFlocks / CFlock.h < prev    next >
C/C++ Source or Header  |  1996-06-23  |  1KB  |  39 lines

  1. #pragma once         /*prevents multiple inclusions of this file */
  2.  
  3. #include "FlockUtils.h"
  4. #include "CBoid.h"
  5.  
  6. #define kMaxBoids     100        // The maximum number of boids allowed
  7.  
  8. class CFlock
  9. {
  10. public:
  11.                 CFlock(void);
  12.     virtual        ~CFlock(void);
  13.     
  14.     ControlRec    fControls;        // The Raw Flock Controls, 0-100
  15.     ControlRec    fGoodControls;            // The processed Flock Controls
  16.     CFlock        *InitFlock(RgnHandle);
  17.     OSErr        FlockStep(RgnHandle);
  18.     void        ShakeFlock(void);
  19.     void        KillFlock(RgnHandle blankRgn);
  20.     OSErr         ControlsChanged(ControlRec *newControls, RgnHandle); // Call when controls change
  21.  
  22. protected:
  23.     CBoid        *fTheBoids[kMaxBoids];    // array of boids
  24.     Rect        fMasterFlockRect;        // the rect describing the world extent
  25.     Rect        fFlockRect;                // the rect describing the world extent, adjusted
  26.                                         // for the boid size
  27.     long        fNumBoids;                // the number of active boids
  28.     double        fMaxEffort;                // the amount of "oomph" a boid can expend each step
  29.                                     
  30.     double        fAwareDist;                // the true distance boids can see
  31.     double        fAwareDistSquared;        // the distance boids can see squared
  32.     
  33.     double        fComfyDist;                // the true inter-boid distance
  34.     double        fComfyDistSquared;        // the inter-boid distance squared
  35.  
  36.     void        FindNeighbors(void);
  37.     void        FlyHome(RgnHandle blankRgn);
  38. };
  39.